package com.aaa.controller.tables;

import com.aaa.dao.ApplyDao;
import com.aaa.dao.ApplyDateMapper;
import com.aaa.dao.ApplyMapper;
import com.aaa.entity.User;
import com.wsc.entity.AaplyDate;
import com.wsc.entity.Apply;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("apply")
public class ApplyController {
    @Resource
    ApplyMapper applyMapper;
    @Resource
    ApplyDao applyDao;
    @Resource
    ApplyDateMapper applyDateMapper;
    @RequestMapping("select")
    public Object select(){
        return   applyMapper.selectList(null);
    }
    @RequestMapping("insert")
    public Integer insert(Apply apply){

        return applyMapper.insert(apply);
    }
    @RequestMapping("delete")
    public Integer delete(Integer id){
        return applyMapper.deleteById(id);
    }
    @RequestMapping("update")
    public Integer update(Apply aaplyDate){
        return applyMapper.updateById(aaplyDate);
    }
    @RequestMapping("select2")
    public List<Apply> select2(){//未审批
        System.out.println(applyDao.select2());
        return applyDao.select2();
    }
    @RequestMapping("select3")
    public List<Apply> select3(){//未提交
        System.out.println(applyDao.select3());
        return applyDao.select3();
    }
    @RequestMapping("select4")
    public List<Apply> select4(){//未提交
        System.out.println(applyDao.select4());
        return applyDao.select4();
    }
    @RequestMapping("selectBuyer")
    public List<User> selectBuyer(){//采购
        System.out.println(applyDao.selectBuyer());
        return applyDao.selectBuyer();
    }
    @RequestMapping("selectTreasure")
    public List<User> selectTreasurer(){//财务
        System.out.println(applyDao.selectTreasure());
        return applyDao.selectTreasure();
    }
    @RequestMapping("selectAuditor")
    public List<User> selectAuditor(){//审核员
        System.out.println(applyDao.selectAuditor());
        return applyDao.selectAuditor();
    }
    @RequestMapping("buyDetails")
    public Integer buyDetails(AaplyDate aaplyDate){//采购详情

        return applyDateMapper.insert(aaplyDate);
    }
    @RequestMapping("selectAll")
    public Object selectAll(){//查询采购与图书
        return   applyDao.selectAll();
    }

}
